<template>
  <div
    class="originProject preview-form"
    style=" background:rgba(255, 255, 255, 0);"
  >
    <div class="comCard">
      <Card dis-hover style=" height:700px;">
        <div
          class="comLabel"
          style=" padding:15px; border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:#E6E6E6; font-size:16px; font-weight:bold;"
        >
          <p>
            &nbsp;部门详情
          </p>
        </div>
        <Form :label-width="120" style=" width:600px; padding:40px; ">
          <FormItem label="部门编码" label-position="left" :label-width="80">
            <Input
              type="text"
              :clearable="true"
              :disabled="true"
              placeholder="请输入部门编码"
              :maxlength="200"
              size="default"
              v-model="details.departmentCode"
            ></Input>
          </FormItem>
          <FormItem label="部门名称" label-position="left" :label-width="80">
            <Input
              type="text"
              :clearable="true"
              :disabled="true"
              placeholder="请输入部门名称"
              :maxlength="200"
              size="default"
              v-model="details.departmentName"
            ></Input>
          </FormItem>
          <FormItem label="部门简介" label-position="left" :label-width="80">
            <Input
              type="textarea"
              :clearable="true"
              :disabled="true"
              placeholder="请输入部门简介"
              :maxlength="200"
              :rows="4"
              size="default"
              v-model="details.synopsis"
            ></Input>
          </FormItem>

          <FormItem>
            <div class="comButton" style=" text-align:left;">
              <div class="btnGroup">
                <Button
                  icon="md-refresh"
                  type="default"
                  size="default"
                  @click="gotoPage('/features/department/deptList')"
                  style=" width:120px;"
                >
                  返回
                </Button>
              </div>
            </div>
          </FormItem>
        </Form>
      </Card>
    </div>
  </div>
</template>
<script>
import selfComponents from "@/components/comm/dtTable/components";
import echarts from "echarts";
import { areaValue, areaData } from "@/libs/common";
import { chartOn, chartOff } from "@/libs/tools";
import area from "@/components/comm/area";

export default {
  components: {
    ...selfComponents,
  },
  data() {
    return {
      details: { departmentCode: "", departmentName: "", synopsis: "" },
      formList: ["details"],
      pageRecordId: "439",
      adminAddress: "http://test.xundacloud.com:8081/xundacloudDemeAdmin",
      area,
    };
  },
  mounted() {
    this.getdeptDetailsDetail();
  },
  methods: {
    getdeptDetailsDetail() {
      if (!this.$route.query.recordId) return;
      const data = JSON.stringify({ recordId: this.$route.query.recordId });
      this.axios.post("/sys/sysDepartment/findKey", { data }).then(resp => {
        const { code, message, data } = resp.data;
        if (code === "E0") {
          this.details = { ...this.details, ...data };

          this.details.province = areaValue(this.area, this.details.province);
        } else {
          this.$Message.error(message);
        }
      });
    },

    gotoPage(functionPath) {
      this.$router.push({ path: functionPath });
    },
  },
};
</script>
